package com.hama.zea.util;

import java.util.ResourceBundle;

/**
 * @author rns
 * 
 */
public class ResourceUtil {
	private ResourceUtil() {
	}

	private static ResourceUtil resource = new ResourceUtil();

	public static ResourceUtil getInstance() {
		return resource;
	}

	/**
	 * @param fileName
	 *            :properties文件的文件名
	 * @param key
	 *            :key值
	 * @return
	 */
	static String getValue(String fileName, String key) {
		if (null == rb) {
			rb = ResourceBundle.getBundle(fileName);
		}
		if (rb.containsKey(key)) {
			return rb.getString(key);
		} else {
			rb = ResourceBundle.getBundle(fileName);
			if (rb.containsKey(key)) {
				return rb.getString(key);
			}
		}
		return null;
	}

	private static ResourceBundle rb;

}
